package com.hps.spring.cloud.initializrstart.service.impl;

import com.hps.spring.cloud.initializrstart.service.DataClient;
import com.hps.spring.cloud.initializrstart.service.WeatherReportService;
import com.hps.spring.cloud.initializrstart.vo.Weather;
import com.hps.spring.cloud.initializrstart.vo.WeatherResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: hps
 * @Description:
 * @Date: Created in 13:59 2018/8/31
 */
@Service
public class WeatherReportServiceImpl implements WeatherReportService {

    @Autowired
    private DataClient dataClient;

    @Override
    public Weather getDataByCityId(String cityId) {
        WeatherResponse weatherResponse = dataClient.getDataByCityId(cityId);
        if (weatherResponse != null) {
            return weatherResponse.getData();
        }
        return null;
    }
}
